/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50710
 Source Host           : localhost:3306
 Source Schema         : xiaowen

 Target Server Type    : MySQL
 Target Server Version : 50710
 File Encoding         : 65001

 Date: 19/09/2024 14:55:06
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for organization
-- ----------------------------
DROP TABLE IF EXISTS `organization`;
CREATE TABLE `organization` (
  `id` int(11) NOT NULL,
  `org_name` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '组织名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

-- ----------------------------
-- Records of organization
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for project
-- ----------------------------
DROP TABLE IF EXISTS `project`;
CREATE TABLE `project` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_name` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '项目名称',
  `org_file_name` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '原文件名',
  `line_number` int(11) DEFAULT NULL COMMENT '行数',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0未删除1已删除',
  `user_Id` int(11) NOT NULL COMMENT '用户id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='项目表';

-- ----------------------------
-- Records of project
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for test
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

-- ----------------------------
-- Records of test
-- ----------------------------
BEGIN;
INSERT INTO `test` (`id`, `name`) VALUES (1, '33');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone_number` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '手机号',
  `name` varchar(45) COLLATE utf8mb4_bin NOT NULL COMMENT '昵称',
  `org_name` varchar(11) COLLATE utf8mb4_bin NOT NULL COMMENT '组织名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

-- ----------------------------
-- Table structure for project_data_title
-- ----------------------------
CREATE TABLE project_data_title (
    id INT(11) NOT NULL AUTO_INCREMENT,
    project_id INT(11) NOT NULL COMMENT '项目id',
    id_column varchar(100) NULL COMMENT 'id列',
    original_word_column varchar(100) NULL COMMENT '原话列',
    project_data_title TEXT NULL COMMENT '数据表头',
    delete_flag TINYINT(1) DEFAULT 0 NOT NULL COMMENT '是否删除',
    create_time DATETIME NULL,
    update_time DATETIME NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='项目数据列表';
CREATE INDEX project_data_title_project_id_IDX USING BTREE ON project_data_title (project_id);

CREATE TABLE project_data (
      id INT(11) NOT NULL AUTO_INCREMENT,
      project_id INT(11) NOT NULL COMMENT '项目id',
      id_val varchar(200) NULL COMMENT 'id列值',
      original_word_val varchar(500) NULL COMMENT '原话列值',
      data_val_ext TEXT NULL COMMENT '额外数据',
      delete_flag TINYINT(1) DEFAULT 0 NOT NULL COMMENT '是否删除',
      create_time DATETIME NULL,
      update_time DATETIME NULL,
      code_ext varchar(500) NULL COMMENT '编码',
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='项目数据表';
CREATE INDEX project_data_project_id_IDX USING BTREE ON project_data (project_id);
CREATE INDEX project_data_project_val_id_IDX USING BTREE ON project_data (project_id, id_val);


CREATE TABLE project_data_code (
      id INT(11) NOT NULL AUTO_INCREMENT,
      project_id INT(11) NOT NULL COMMENT '项目id',
      project_data_id INT(11) not NULL COMMENT '数据id',
      code INT(10) not NULL COMMENT '编码code',
      name varchar(200) NOT NULL COMMENT '编码名称',
      delete_flag TINYINT(1) DEFAULT 0 NOT NULL COMMENT '是否删除',
      create_time DATETIME NULL,
      update_time DATETIME NULL,
      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci COMMENT='项目数据编码表';
CREATE INDEX project_data_code_project_IDX USING BTREE ON project_data_code (project_id, project_data_id);
CREATE INDEX project_data_code_code_IDX USING BTREE ON project_data_code (project_id, code);



CREATE TABLE code_data (
       id INT(11) auto_increment NOT NULL,
       project_id INT(11) NOT NULL COMMENT '项目id',
       level INT(2) DEFAULT 1 NOT NULL COMMENT '层级',
       code INT(10) NOT NULL COMMENT '编码code',
       name varchar(200) NOT NULL COMMENT '编码名称',
       parent_code INT(10) NULL COMMENT '父code',
       type INT(2) DEFAULT 1 NOT NULL COMMENT '类型 1:值, 2:分类',
       delete_flag TINYINT(1) DEFAULT 0 NOT NULL,
       create_time DATETIME NULL,
       update_time DATETIME NULL,
       create_user INT(11) NULL,
       sort INT(4) NULL COMMENT '排序',
       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE INDEX code_data_project_id_IDX USING BTREE ON code_data (project_id);
CREATE INDEX code_project_parent_code_IDX USING BTREE ON code_data (project_id,parent_code);



CREATE TABLE code_data_request_param (
       id INT(11) auto_increment NOT NULL,
       project_id INT(11) NOT NULL COMMENT '项目id',
       name varchar(50) NOT NULL COMMENT '方法名',
       request TEXT NULL COMMENT '请求参数',
       response TEXT NULL COMMENT '返回参数',
       create_time DATETIME NULL,
       update_time DATETIME NULL,
       create_user INT(11) NULL,
       cost_time INT(11) NULL COMMENT '耗时（毫秒）',
       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
CREATE INDEX code_data_request_param_project_IDX USING BTREE ON code_data_request_param (project_id);
-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `phone_number`, `name`, `org_name`) VALUES (1, '18602605878', '温浩', '44');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
